<?php
/**
 * Created by PhpStorm.
 * User: songs
 * Date: 2020/5/16
 * Time: 16:03
 */

namespace App\admin\FormView;


use App\Models\Admin\UserModel;

class UserInfoFormView例子 extends BaseViewForm
{
    public function get_model()
    {
        return new UserModel();
    }

  /**
     * 表单提交按钮显示的文本,如果为空,则不现实按钮
     */
    public $submit =false;

    /**
     * 需要继承,然后定义每行需要显示的数据格式
     */
    public function Labels()
    {
        return [
            [
                'title' => '这是标题',
                'field' => 'name',
                'type' => self::labelTypeTextEdit,
                'must' => true,
                'save'=>true,
                'attr' => ['test' => '123']
            ],
            [
                'title' => '这是文本展示',
                'field' => 'name',
                'type' => self::labeltextshow,
                'must' => true,
                'attr' => ['test' => '123']
            ],
            [
                'title' => '这是图片',
                'field' => 'head',
                'type' => self::labelPic,
                'must' => true,
                'save'=>true,
                'attr' => ['test' => '123']
            ],
            [
                'title' => '这是图片2',
                'field' => 'head2',
                'type' => self::labelPic,
                'must' => true,
                'attr' => ['test' => '123']
            ],
            [
                'title' => '多行文本',
                'field' => 'notes',
                'type' => self::labeltextarea,
                'must' => true,
                'save'=>true,
                'attr' => ['test' => '123']
            ],
            [
                'title' => '富文本',
                'field' => 'notesHtml',
                'type' => self::labeltexthtml,
                'must' => true,
                'save'=>false,
                'attr' => ['test' => '123']
            ],
            [
                'title' => '性别',
                'field' => 'sex',
                'type' => self::labelDownList,
                'must' => true,
                'save'=>true,
                'attr' => ['test' => '123'],
                'list' => [
                    ///1男，2女，
                    0 => '未知',
                    1 => '男',
                    2 => '女'
                ]
            ],
            [
                'title' => '复选框',
                'field' => 'testfield',
                'type' => self::labelcheckbox,
                'must' => true,
                'attr' => ['test' => '123'],
                'list' => [
                    1 => '测试数据1',
                    2 => '测试数据2',
                    3 => '测试数据3',
                    4 => '测试数据4',
                    5 => '测试数据5',
                    6 => '测试数据6',
                ]
            ],
        ];
    }
}